package com.hjd.shop.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.baomidou.mybatisplus.plugins.Page;
import com.hjd.shop.dto.goods.AddGoodsDto;
import com.hjd.shop.dto.goods.GoodsRequestPageDto;
import com.hjd.shop.entity.Goods;
import com.hjd.shop.response.Response;
import com.hjd.shop.response.SuccessResponse;
import com.hjd.shop.service.IGoodsService;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商品表 前端控制器
 * </p>
 *
 * @author 我玩亚索我会C
 * @since 2020-12-09
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Reference
    private IGoodsService goodsService;

    @PostMapping("/addGoods")
    public Response addGoods(@RequestBody AddGoodsDto addGoodsDto){
        goodsService.insert(addGoodsDto);
        return new SuccessResponse();
    }
    @GetMapping("/page")
    public Page<Goods> queryPage(GoodsRequestPageDto dto){
        return goodsService.queryList(dto);
    }
}
